home *** CD-ROM | disk | FTP | other *** search
- Path: dfw.dfw.net!not-for-mail
- From: jtmcap@dfw.dfw.net (Jerry Jackson)
- Newsgroups: comp.lang.c
- Subject: sscanf bug??????
- Date: 10 Feb 1996 18:08:56 GMT
- Organization: DFW Internet Services - DFWNet: 800-2-DFWNet
- Message-ID: <4fimvo$82s@fnord.dfw.net>
- NNTP-Posting-Host: dfw.dfw.net
- X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
-
- the following is a program compiled using microway ndp c/c++ compiler.
-
- #include <stdio.h>
- #include <string.h>
-
- main()
- {
- char str_1[] = "013196";
- char str_2[] = "13196";
- long res_1, res_2;
-
- sscanf(str_1,"%d",&res_1);
- sscanf(str_2,"%d",&res_2);
-
- printf("\nres_1 = %d",res_1);
- printf("\nres_2 = %d",res_2);
- }
-
- the output looks like this:
-
- res_1 = 89
- res_2 = 13196
-
-
- microway says that the leading zero causes sscanf to do an octal
- conversion on the integer. i have not found any documentation to verify
- this. also other compilers that i use return the value 13196 for both
- calls to sscanf.
-
- bug or undocumented feature?
-
-